package edu.biwu.config;

import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.dbutils.QueryRunner;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.*;

import javax.sql.DataSource;
import java.sql.Connection;

/**
 * @author 王俊彪
 * @version 1.0
 * 这个类作为spring的配置类，用来取代spring配置文件
 */
@Configuration//代表这个类是spring配置类，相当于将xml转换成java类和注解形式
@ComponentScan("edu.biwu")//开启注解扫描
@PropertySource("classpath:db.properties")//加载配置文件
@Import(DBConfig.class)
public class SpringConfig {

    @Bean
    public ThreadLocal<Connection> createThreadLocal(){
        return new ThreadLocal<>();
    }
}
